package com.virtual.repository.common.criteria;

import java.util.List;

import com.virtual.repository.common.operators.CriteriaOperator;
import com.virtual.repository.common.operators.LogicalOperator;

/**
 * A generalized builder for the <code>Criterion</code> class.
 * @author Zielony
 * @version 1.0
 */
public interface ICriteriaBuilder {
	/**
	 * Adds a new, arbitrary <code>Criterion</code> with no preceding logical operator.
	 * @param property the property of the treated object on which the criterion is set.
	 * @param operator the operator expressing the criterion.
	 * @param value the value determining the criterion.
	 */
	public abstract void addCriterion(String property,
			CriteriaOperator operator, Object value);

	/**
	 * Adds a new, arbitrary <code>Criterion</code> with a preceding <code>prefixOperator</code>.
	 * @param prefixOperator the <code>LogicalOperator</code> linking the criterion to the previous statement.
	 * @param property the property of the treated object on which the criterion is set.
	 * @param operator the operator expressing the criterion.
	 * @param value the value determining the criterion.
	 */
	public abstract void addCriterion(LogicalOperator prefixOperator,
			String property, CriteriaOperator operator, Object value);

	/**
	 * Builds the <code>List</code> of criteria from the given source material. 
	 * @return the <code>List</code> of criteria from the given source material.
	 * @throws CloneNotSupportedException  if cloning is not supported by the criteria.
	 */
	public abstract List<Criterion> build() throws CloneNotSupportedException;
}